

/*
* Copyright @ 2017 com.iflysse.trains
* crm 下午9:24:08
* All right reserved.
*
*/
	
package com.qf.service.serviceImpl;

import java.util.ArrayList;
import java.util.List;

import com.qf.dao.CrmPostDao;
import com.qf.dto.CrmPostDto;
import com.qf.pojo.CrmPost;
import com.qf.pojo.PagePost;
import com.qf.service.CrmPostService;

/**
* @desc: crm
* @descripe:XXXX
* @author: 周锐
* @createTime: 2017年7月24日 下午9:24:08
* @history:
* @version: v1.0

*/

public class CrmPostServiceImpl implements CrmPostService {
    private CrmPostDao pd;
    
	/*
	*(non-Javadoc)
	* @see com.qf.service.CrmPostService#addPost(com.qf.pojo.CrmPost)
	*/

	
	/**
	* @param pd the pd to set
	*/
	
	public void setPd(CrmPostDao pd) {
	
		this.pd = pd;
	}

	@Override
	public void addPost(CrmPost post) {

		pd.addPost(post);

	}

	/*
	*(non-Javadoc)
	* @see com.qf.service.CrmPostService#findbyPage(int, int)
	*/

	@Override
	public PagePost findbyPage(int page, int size) {

		//TODO
		return pd.findbyPage(page, size);

	}

	
	/*
	*(non-Javadoc)
	* @see com.qf.service.CrmPostService#update(com.qf.pojo.CrmPost)
	*/
		
	@Override
	public void updatePost(CrmPost post) {
		
		pd.updatePost(post);
			
	}

	
	/*
	*(non-Javadoc)
	* @see com.qf.service.CrmPostService#findbyId(java.lang.Long)
	*/
		
	@Override
	public CrmPost findbyId(Long postId) {
		
		//TODO
		return pd.findbyId(postId);
			
	}

	
	/*
	*(non-Javadoc)
	* @see com.qf.service.CrmPostService#findbyAllcrmStaff()
	*/
		
	@Override
	public List<CrmPostDto> findbyAllPost(Long deptId) {
		
		List<CrmPost> list = pd.findbyAllPost(deptId);
		List<CrmPostDto> posts=new ArrayList<>();
		for(CrmPost post:list){
			CrmPostDto postdto=new CrmPostDto();
			postdto.setPostId(post.getPostId());
			postdto.setPostName(post.getPostName());
			posts.add(postdto);
		}
		return posts;	
	}

}

	